﻿@inject IJSRuntime JSRuntime
@inject NavigationManager NavigationManager

<div style="width: 90%" @ref="markdownContainer"></div>


@code {
    private ElementReference markdownContainer;

    [Parameter] public string html { get; set; } = "";

    protected override void OnParametersSet()
    {
        if (string.IsNullOrEmpty(html)) return;
        JSRuntime.InvokeVoidAsync("insertHtml", markdownContainer, html);
    }
    
}

<script>
    window.insertHtml = function (element, html) {
        element.innerHTML = html;
        Prism.highlightAll(); // 如果使用 Prism.js
    }
</script>


<style>
    .img-fluid{
        max-width: 80%;
    }
</style>